package net.cyndeline.game

import net.cyndeline.entitySystem.EntityRef

/**
 * Manages the order in which units on the map may
 * take turns to perform actions.
 */
trait TurnHandler {
  
  /** 
   * Checks if an entity is set to participate in the
   * turn rotation.
   */
  def contains(entity: EntityRef): Boolean
  
  /**
   * Adds an entity to the rotation, with the lowest
   * priority to receive its turn upon insertion.
   */
  def add(entity: EntityRef)
  
  /**
   * Removes an entity from the rotation, the rest of
   * the member collection remains intact.
   */
  def remove(entity: EntityRef)
  
  /**
   * Returns the entity who's turn it currently is.
   */
  def current: EntityRef
  
  /**
   * Rotates the underlying collection of members one step.
   * 
   * @return The next entity to receive its turn.
   */
  def next(): EntityRef
  
  /**
   * Checks if there are any entities waiting for their turn.
   */
  def isEmpty: Boolean
}